﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GrouponDesktop.RegistroConsumoCupon
{
    public partial class RegistroConsumoCup : Form
    {

        private int idProv;

        public RegistroConsumoCup(int id)
        {
            this.idProv = id;
            InitializeComponent();
            if (string.IsNullOrEmpty(this.tb_cli.Text))
            {
                b_buscC.Enabled = false;
            }
            else
            {
                b_buscC.Enabled = true;

            }
            
        }

        private void b_busc_Click(object sender, EventArgs e)
        {
            AbmCliente.ABMclient busc = new AbmCliente.ABMclient(this.tb_cli,0,idProv);
            busc.Show();

        }

        private void tb_cli_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.tb_cli.Text))
            {
                b_buscC.Enabled = false;
                            }
            else
            {
                b_buscC.Enabled = true;
                
            }
        }

        private void b_buscC_Click(object sender, EventArgs e)
        {
            AbmCliente.ABMclient busc = new AbmCliente.ABMclient(this.tb_cup, Convert.ToInt32(this.tb_cli.Text), idProv);
            busc.Show();
        }

        private void b_reg_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Registro Efectuado");
            BDConnection.execute("EXEC CodingSpree.insertReg " + this.tb_cup.Text + ", '" + variablesGlobales.Configuracion.fechaHoy + "'");
        }
    }
}
